package com.mhh.selary.backend.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 角色(1:管理员 2:测试人员)
 *
 * @author mhh
 * @date 2020-11-23 16:01:40
 */
@Getter
@AllArgsConstructor
public enum UserRoleEnum {

    /**
     *
     */
    ADMIN(1, "管理员"),

    TEST(2, "测试人员"),
    ;

    private Integer role;

    private String desc;

    public static UserRoleEnum valueBy(Integer role) {
        return Arrays.stream(UserRoleEnum.values()).filter(enumItem -> enumItem.getRole().equals(role)).findFirst().orElse(null);
    }
}
